package com.eam.asset.category.util;


import com.eam.asset.assetApplication.domain.DisposalCategory;
import com.eam.asset.assetApplication.dto.DisposalCategoryDto;
import com.eam.asset.category.domain.AssetCategory;
import com.eam.asset.category.dto.AssetCategoryDto;
import com.eam.common.utils.bean.BeanUtils;

import static com.eam.asset.category.Enum.CategoryTypeEnum.*;

public class CategoryUtil {
    public static String Generate(String value) {
        if (HOUSE.getValue().equals(value)) {
            return HOUSE.getName();
        } else if (LAND.getValue().equals(value)) {
            return LAND.getName();
        } else if (PLACE.getValue().equals(value)) {
            return PLACE.getName();
        } else if (AD.getValue().equals(value)) {
            return AD.getName();
        } else if (BERTH.getValue().equals(value)) {
            return BERTH.getName();
        }
        return "";
    }

    //将po转换成dto
    public static AssetCategoryDto DtoTransform(AssetCategory assetCategory) {
        AssetCategoryDto assetCategoryDto = new AssetCategoryDto();
        BeanUtils.copyProperties(assetCategory, assetCategoryDto);
        return assetCategoryDto;
    }

    public static DisposalCategoryDto DtoTransform(DisposalCategory disposalCategory) {
        DisposalCategoryDto disposalCategoryDto = new DisposalCategoryDto();
        BeanUtils.copyProperties(disposalCategory, disposalCategoryDto);
        return disposalCategoryDto;
    }
}
